//
//  NoVipModel.m
//  ChatForHot
//
//  Created by FLY on 2018/10/19.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "NoVipModel.h"
#import <UIKit/UIKit.h>

@interface NoVipModel()

@property (nonatomic,strong) UILabel *HOTCHATlab;

@end
@implementation NoVipModel

+ (NSArray *)HOTCHAThelpArrayWithDic:(NSDictionary *)dic{
    NSMutableArray *array = [[NSMutableArray alloc] init];
    NSString *msg = dic[@"description"];
    if ([msg length] > 0) {
        
        [array addObject:[NoVipModel initWithMsg:msg touchType:0]];
    }
    
    NSString *msg2 = NSLocalizedString(@"novip01", nil);
    if (msg.length > 0) {
        [array addObject:[NoVipModel initWithMsg:msg2 touchType:1]];
    }
    
    NSString *msg3 = NSLocalizedString(@"novip02", nil);
    if (msg.length > 0) {
        [array addObject:[NoVipModel initWithMsg:msg3 touchType:2]];
    }
    //    for (int i = 1;  i <= 7; i ++) {
    //        NSString *key = [NSString stringWithFormat:@"NoVip_%02d",i];
    //        NSString *msg = NSLocalizedString(key, nil);
    //        if (msg.length > 0) {
    //            [array addObject:[NoVipModel initWithMsg:msg touchType:i]];
    //        }
    //    }
    
    return array;
}

+ (instancetype)initWithMsg:(NSString *)msg touchType:(NSInteger)touchType{
    NoVipModel *va = [[NoVipModel alloc] init];
    va.msg = msg;
    va.touchType = touchType;
    
    [va getRowHeight];
    
    return va;
}

- (void)getRowHeight{
    float hh = 0;
    
    self.HOTCHATlab.frame = CGRectMake(0, 0, HOTCHATUIWIDTH-60, HOTCHATUIHEIGHT);
    self.HOTCHATlab.text = self.msg;
    [self.HOTCHATlab sizeToFit];
    hh = self.HOTCHATlab.bounds.size.height + 6;
    if (hh < 30) {
        hh = 20;
    }
    
    self.height = hh;
}

- (UILabel *)HOTCHATlab{
    if (_HOTCHATlab == nil) {
        _HOTCHATlab = [[UILabel alloc] init];
        _HOTCHATlab.font = [UIFont systemFontOfSize:13];
        _HOTCHATlab.numberOfLines = 0;
        _HOTCHATlab.frame = CGRectMake(0, 0, HOTCHATUIWIDTH-60, HOTCHATUIHEIGHT);
    }
    return _HOTCHATlab;
}

@end
